package com.yanqu.road.server.cmd.ping;

import com.yanqu.road.pb.common.ConfigProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.player.UserMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.GameProtocol;

/**
 * @Author wpj
 * @Date 2021/8/30
 */
@Cmd(code = GameProtocol.S_KT, desc = "")
public class KTCmd extends AbstractCommand {
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        ConfigProto.Ek ekMsg = ConfigProto.Ek.parseFrom(packet.getBytes());
        player.setK(ekMsg.getEk());

        if (player.getK().equals(UserMgr.K)) {
            player.setRec(player.getRec() + 1);
        }
//        log.error("rec S_KT : {}", ekMsg.getEk());
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
